package com.atwork.wuhua.ui.activity;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.atwork.wuhua.R;
import com.atwork.wuhua.base.BaseActivity;
import com.atwork.wuhua.base.MyApplication;
import com.atwork.wuhua.utils.Util;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class KefuActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;

    @Override
    protected boolean isBindEventBus() {
        return false;
    }

    @Override
    public int intiLayout() {
        return R.layout.activity_kefu;
    }

    @Override
    public void initView() {
        tvTitle.setText("联系客服");
    }

    @Override
    public void initData() {

    }


    @OnClick({R.id.img_left, R.id.rly_qq, R.id.rly_weixin})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_left:
                finish();
                break;
            case R.id.rly_qq:
                try {
                    //123是你自己要跳转的QQ号码
                    String urlQQ = "mqqwpa://im/chat?chat_type=wpa&uin=" + MyApplication.systemBean.getData().getQq() + "&version=1";
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(urlQQ)));
                } catch (Exception e) {
                    //如果没有装ＱＱ，检测异常，不然会出问题滴！
                    Toast.makeText(this, "我的妈呀！你居然没装QQ！", Toast.LENGTH_SHORT).show();
                }
                break;
            case R.id.rly_weixin:
                final ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                ClipData cd = ClipData.newPlainText("lable", MyApplication.systemBean.getData().getWechat());
                cm.setPrimaryClip(cd);
                showToast("复制成功");
                break;
        }
    }
}
